import { default as request, cloud } from '@/framework/utils/request'

// 添加/修改场景分类
export function classifyAddApi(query, isAdd) {
  return request({
    url: cloud.interfacePlatform + '/scene/classify/' + (isAdd ? 'edit' : 'add'),
    method: 'post',
    data: query
  })
}

// 获取场景分类树结构
export function classifyGetTreeApi(query) {
  return request({
    url: cloud.interfacePlatform + '/scene/classify/getTree',
    method: 'get',
    params: query
  })
}

// 获取场景分类树结构只有分类
export function onlyClassifyGetTreeApi(query) {
  return request({
    url: cloud.interfacePlatform + '/scene/classify/getTreeOnlyClassify',
    method: 'get',
    params: query
  })
}

// 获取场景分类树结构只有分类-根据系统获取
export function getTreeOnlyClassifyBySystemIdApi(query) {
  return request({
    url: cloud.interfacePlatform + '/scene/classify/getTreeOnlyClassifyBySystemId',
    method: 'get',
    params: query
  })
}

// 删除场景分类
export function classifyDeleteApi(query) {
  return request({
    url: cloud.interfacePlatform + '/scene/classify/delete',
    method: 'post',
    data: query
  })
}

// 添加/修改场景基础信息
export function sceneAddApi(query, isAdd) {
  return request({
    url: cloud.interfacePlatform + '/scene/' + (isAdd ? 'update' : 'add'),
    method: 'post',
    data: query
  })
}

// 删除场景
export function sceneDeleteApi(query) {
  return request({
    url: cloud.interfacePlatform + '/scene/delete',
    method: 'post',
    data: query
  })
}

// 获取场景基础信息
export function sceneGetDetailApi(query) {
  return request({
    url: cloud.interfacePlatform + '/scene/getDetail',
    method: 'get',
    params: query
  })
}

// 保存图形
export function addApi(query, isAdd) {
  return request({
    url: cloud.interfacePlatform + '/serviceAdaptation/' + (isAdd ? 'update' : 'add'),
    method: 'post',
    data: query
  })
}

// 查询图形/场景
export function getDetailApi(query) {
  return request({
    url: cloud.interfacePlatform + '/serviceAdaptation/getDetail',
    method: 'get',
    params: query
  })
}

// 获取可选的提供方系统信息
export function getProviderSystemInfoApi(query) {
  return request({
    url: cloud.interfacePlatform + '/serviceAdaptation/getProviderSystemInfo',
    method: 'get',
    params: query
  })
}

// 可选的提供方的ID对应可选的提供方接口
export function getInterfaceListApi(query) {
  return request({
    url: cloud.interfacePlatform + '/serviceAdaptation/getInterfaceList',
    method: 'get',
    params: query
  })
}

// 连通测试
export function connectivityTestApi(query) {
  return request({
    url: cloud.interfacePlatform + '/serviceAdaptation/connectivityTest',
    method: 'post',
    data: query
  })
}

// 1未启动 2已启动
export function executingApi(query, isStart) {
  return request({
    url: cloud.interfacePlatform + '/serviceAdaptation/' + (isStart == '1' ? 'start' : 'stop'),
    method: 'post',
    data: query
  })
}

// 连通日志
export function connectPageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/log/connect/page',
    method: 'get',
    params: query
  })
}

// 执行日志
export function executionPageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/log/execution/page',
    method: 'get',
    params: query
  })
}

// 操作日志
export function operatePageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/log/operate/page',
    method: 'get',
    params: query
  })
}

// 告警日志
export function alarPageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/log/alar/page',
    method: 'get',
    params: query
  })
}

// 执行日志-详情
export function executionDetailPageApi(query) {
  return request({
    url: cloud.interfacePlatform + '/log/execution/detail/page',
    method: 'get',
    params: query
  })
}
